﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;

namespace HuntTheWumpus
{
	class Cave
	{
		 int[,] cavesystemSelected = new int[30, 6];
        public Cave() { }
        public int[] GiveRoom(int roomNumber)
        {
            int[] room = new int[6];
            try
            {
                for (int j = 0; j < 6; j++)
                {
                    room[j] = cavesystemSelected[roomNumber, j];
                }
            }
            catch
            {
               MessageBox.Show("ERROR:room");
            }
            return room;
        }
        public int[,] GiveCaveSystem(int caveSelected)
        {
            try
            {
                string[] filenames = { "cave1.txt", "cave2.txt", "cave3.txt", "cave4.txt", "cave5.txt" };
                TextReader tr = new StreamReader(filenames[caveSelected - 1]);
                string input = tr.ReadLine();

                int roomCounter = 0;
                while (input != null)
                {
                    string[] data = input.Split(',');
                    for (int j = 0; j < 6; j++)
                    {
                        cavesystemSelected[roomCounter, j] = int.Parse(data[j]);
                    }
                    roomCounter++;
                    input = tr.ReadLine();
                }
            }
            catch 
            {
               MessageBox.Show("ERROR:system");
            }
            return cavesystemSelected;
        }
    }
}
	

